/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uccart_project.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;


@Entity
@Table(name = "beca")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Beca.findAll", query = "SELECT b FROM Beca b"),
    @NamedQuery(name = "Beca.findByBecaIdestudiante", query = "SELECT b FROM Beca b WHERE b.becaIdestudiante = :becaIdestudiante"),
    @NamedQuery(name = "Beca.findByBecaInicio", query = "SELECT b FROM Beca b WHERE b.becaInicio = :becaInicio"),
    @NamedQuery(name = "Beca.findByBecaVencimiento", query = "SELECT b FROM Beca b WHERE b.becaVencimiento = :becaVencimiento"),
    @NamedQuery(name = "Beca.findByBecaTipo", query = "SELECT b FROM Beca b WHERE b.becaTipo = :becaTipo"),
    @NamedQuery(name = "Beca.findByBecaPorcentaje", query = "SELECT b FROM Beca b WHERE b.becaPorcentaje = :becaPorcentaje")})
public class Beca implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "beca_idestudiante")
    private String becaIdestudiante;
    @Column(name = "beca_inicio")
    @Temporal(TemporalType.DATE)
    private Date becaInicio;
    @Basic(optional = false)
    @Column(name = "beca_vencimiento")
    @Temporal(TemporalType.DATE)
    private Date becaVencimiento;
    @Column(name = "beca_tipo")
    private Short becaTipo;
    @Basic(optional = false)
    @Column(name = "beca_porcentaje")
    private int becaPorcentaje;
    @JoinColumn(name = "beca_idestudiante", referencedColumnName = "est_id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Estudiante estudiante;

    public Beca() {
    }

    public Beca(String becaIdestudiante) {
        this.becaIdestudiante = becaIdestudiante;
    }

    public Beca(String becaIdestudiante, Date becaVencimiento, int becaPorcentaje) {
        this.becaIdestudiante = becaIdestudiante;
        this.becaVencimiento = becaVencimiento;
        this.becaPorcentaje = becaPorcentaje;
    }

    public String getBecaIdestudiante() {
        return becaIdestudiante;
    }

    public void setBecaIdestudiante(String becaIdestudiante) {
        this.becaIdestudiante = becaIdestudiante;
    }

    public Date getBecaInicio() {
        return becaInicio;
    }

    public void setBecaInicio(Date becaInicio) {
        this.becaInicio = becaInicio;
    }

    public Date getBecaVencimiento() {
        return becaVencimiento;
    }

    public void setBecaVencimiento(Date becaVencimiento) {
        this.becaVencimiento = becaVencimiento;
    }

    public Short getBecaTipo() {
        return becaTipo;
    }

    public void setBecaTipo(Short becaTipo) {
        this.becaTipo = becaTipo;
    }

    public int getBecaPorcentaje() {
        return becaPorcentaje;
    }

    public void setBecaPorcentaje(int becaPorcentaje) {
        this.becaPorcentaje = becaPorcentaje;
    }

    public Estudiante getEstudiante() {
        return estudiante;
    }

    public void setEstudiante(Estudiante estudiante) {
        this.estudiante = estudiante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (becaIdestudiante != null ? becaIdestudiante.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Beca)) {
            return false;
        }
        Beca other = (Beca) object;
        if ((this.becaIdestudiante == null && other.becaIdestudiante != null) || (this.becaIdestudiante != null && !this.becaIdestudiante.equals(other.becaIdestudiante))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.uccart_project.model.Beca[ becaIdestudiante=" + becaIdestudiante + " ]";
    }
    
}
